﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GmInplaceEdit.h"
#include "NdbObjectSchematic.h"
#include "IDbObject.h"
#include "DbDataSchema.h"

namespace gcmp
{
    // 跨进程调用传输的数据对象基类
    class GM_INPLACE_EDIT_EXPORT RpcSharedObject : public NdbObjectSchematic, public IDbObject
    {
        DBOBJECT_DATA_BEGIN_AND_QUICK_CAST_FROM(gcmp, RpcSharedObject, gcmp::NdbObjectSchematic, 4A4CB856 - 226C - 4765 - B858 - 8BFA12CF0C0B, gminplaceedit, gcmp::IDbObject)
        DBOBJECT_DATA_END

    public: //实现NdbObject接口
        virtual NdbObject* GetTopOwnerObject() const override
        {
            return nullptr;
        }
    };

    // 进程基本信息
    class GM_INPLACE_EDIT_EXPORT RpcServerInfo : public RpcSharedObject
    {
        DBOBJECT_DATA_BEGIN(gcmp, RpcServerInfo, gcmp::RpcSharedObject, 5178971A - E613 - 4D2F - A3BA - 0787BB8230C7, gminplaceedit)
            DATA(Guid, ServerGuid)
            DATA(UInt16, Port)
            DATA(std::wstring, AppName)
        DBOBJECT_DATA_END

    public:
        RpcServerInfo(const GUID& serverGuid, uint16_t port, const std::wstring& appName);

    public:
        Guid GetServerGuid() const { return this->GetServerGuid__(); }
        uint16_t GetPort() const { return this->GetPort__(); }
        std::wstring GetAppName() const { return this->GetAppName__(); }
    };

}// namespace gcmp
